<?php
	$template->_template_read("System/Design/Templates/login.html");
	$template->_template_assign("DESIGN", DESIGN);
	$template->_template_assign("TITEL", (string)$language->titles->value_1);
	$template->_template_assign("CAPTION_LOGIN1", (string)$language->msgs->value_1);
	$template->_template_assign("CAPTION_LOGIN2", (string)$language->buttons->value_1);
	$template->_template_assign("CAPTION_LOGIN3", (string)$language->common->value_1);
	$template->_template_assign("LEGEND_ERROR", (string)$language->legends->value_1);
	switch ($_GET["step"]){
		case "1":
			if(sha1($_POST["pass"]) != file_get_contents("System/Security/password.txt")){
				sprintf((string)$language->log_msgs->value_1, $_POST["pass"]);
				oyster_log("ERROR", sprintf((string)$language->log_msgs->value_1, $_POST["pass"],$_POST["pass"]), "Oyster Login");
				$template->_template_assign("ERROR",(string)$language->errors->value_1);
				echo $template->_template_toHTML();
				echo $footer->_template_toHTML();
				exit();
			} else {
				setcookie("oyster2000cl", sha1($_POST["pass"]), COOKIE_LIFE);
				header("Location: main.php");
			}
		break;
		default:
			echo $template->_template_toHTML();
			echo $footer->_template_toHTML();
			exit();
	}
?>